package com.keekus.common.dto.security;
import java.util.Comparator;
import java.util.List;

import org.springframework.security.core.GrantedAuthority;

import com.keekus.common.dto.BaseDTO;

public class Role extends BaseDTO implements Comparator<Role> {

	private static final long	serialVersionUID	= 3907935485445897777L;

	private String				id;
	private String				roleName;
	private String				roleDesc;
	private Boolean				isEnabled;
	private List<GrantedAuthority>		authorities;

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public List<GrantedAuthority> getAuthorities() {
		return authorities;
	}

	public void setAuthorities(List<GrantedAuthority> authorities) {
		this.authorities = authorities;
	}

	public String getRoleDesc() {
		return roleDesc;
	}

	public void setRoleDesc(String roleDesc) {
		this.roleDesc = roleDesc;
	}

	public Boolean getIsEnabled() {
		return isEnabled;
	}

	public void setIsEnabled(Boolean isEnabled) {
		this.isEnabled = isEnabled;
	}



	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Override
	public int compare(Role r1, Role r2) {
		if (r1.getRoleName() == null) {
			return -1;
		}
		if (r2.getRoleName() == null) {
			return 1;
		}
		return r1.getRoleName().compareTo(r2.getRoleName());
	}

}
